<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
$api = app('Dingo\Api\Routing\Router');
//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});


$api->version('v1',  ['middleware' => 'api.throttle', 'limit' => 1000, 'expires' => 5], function ($api) {
    $api->group(['prefix' => 'v1', 'namespace' => 'App\Api\V1\Controllers'], function ($api) {
        $api->get('/app/method/{method}', 'AppController@index')->where('method', '[A-Za-z\.]+');
        //商品
        $api->get('/goods/method/{method}', 'GoodsController@index')->where('method','[a-z\.]+');
        //商品分类
        $api->get('/goodscategory/method/{method}', 'GoodsCategoryController@index')->where('method','[a-z\.]+');
        //商品品牌
        $api->get('/brand/method/{method}', 'BrandController@index')->where('method','[a-z\.]+');
        //商品模型
        $api->get('/goodstype/method/{method}', 'GoodsTypeController@index')->where('method','[a-z\.]+');

        $api->get('/ask/method/{method}', 'AskController@index')->where('method','[a-z\.]+');

        $api->get('/navigation/method/{method}', 'NavigationController@index')->where('method','[a-z\.]+');

        $api->get('/appinstall/method/{method}', 'NavigationController@index')->where('method','[a-z\.]+');

        /*管理组账号*/
        $api->get('/admin/method/{method}', 'AdminController@index')->where('method', '[A-Za-z\.]+');
        /*顾客组账号*/
        $api->get('/user/method/{method}', 'UserController@index')->where('method', '[A-Za-z\.]+');
<<<<<<< HEAD
        /*账号资金*/
        $api->get('/user_money/method/{method}', 'UserMoneyController@index')->where('method', '[A-Za-z\.]+');
        /*账号等级*/
        $api->get('/user_level/method/{method}', 'UserLevelController@index')->where('method', '[A-Za-z\.]+');
        /*收货地址*/
        $api->get('/user_address/method/{method}', 'UserAddressController@index')->where('method', '[A-Za-z\.]+');
        /*提现账号*/
        $api->get('/withdraw_user/method/{method}', 'WithdrawUserController@index')->where('method', '[A-Za-z\.]+');

=======
        
>>>>>>> 3037766af93486699c0fff4b6695e739b8e5173c
        /*添加优惠卷接口*/
        $api->get('/coupon/method/{method}', 'CouponController@index')->where('method', '[A-Za-z\.]+');
       /*购物卡相关接口*/
        $api->get('/card/method/{method}', 'CardController@index')->where('method', '[A-Za-z\.]+');
        /*订单促销*/
        $api->get('/promotion/method/{method}', 'PromotionController@index')->where('method', '[A-Za-z\.]+');
        /*订单*/
        $api->get('/order/method/{method}', 'OrderController@index')->where('method', '[A-Za-z\.]+');



        $api->get('/app', 'AppController@index');

        //文章管理
        $api->get('/article/method/{method}', 'ArticleController@index')->where('method', '[A-Za-z\.]+');
        //文章分类
        $api->get('/articlecat/method/{method}', 'ArticleCatController@index')->where('method', '[A-Za-z\.]+');
        //专题管理
        $api->get('/topic/method/{method}', 'TopicController@index')->where('method', '[A-Za-z\.]+');

        $api->post('/notice/method/{method}', 'NoticeController@index')->where('method', '[A-Za-z\.]+');
        /*通知*/
        $api->get('/notice/method/{method}', 'NoticeController@index')->where('method', '[A-Za-z\.]+');
        /*消息*/
        $api->get('/message/method/{method}', 'MessageController@index')->where('method', '[A-Za-z\.]+');

        $api->get('/transaction/method/{method}', 'TransactionController@index')->where('method', '[A-Za-z\.]+');
        $api->get('/payment/method/{method}', 'PaymentController@index')->where('method', '[A-Za-z\.]+');
        $api->get('/ads/method/{method}', 'adsController@index')->where('method', '[A-Za-z\.]+');
        $api->get('/adsPosition/method/{method}', 'AdsPositionController@index')->where('method', '[A-Za-z\.]+');


        $api->get('/transaction/method/{method}', 'TransactionController@index')->where('method', '[A-Za-z\.]+');


        $api->get('/notice/method/{method}', 'notice@index')->where('method', '[A-Za-z\.]+');

        $api->get('/upload/method/{method}', 'UploadController@index')->where('method', '[A-Za-z\.]+');

        $api->post('/auth/signup', 'AuthController@postSignup');
        $api->post('/auth/login', 'AuthController@postLogin');

        $api->get('/user/{id}', 'TestController@show');
        $api->get('/auth/apps', 'TestController@apps');
        $api->get('/auth/user', 'AuthController@getUser');
        $api->patch('/auth/refresh', 'AuthController@patchRefresh');
        $api->delete('/auth/invalidate', 'AuthController@deleteInvalidate');
        /* 抽奖相关接口 */
        $api->get('/lotterys', 'LotteryController@index');
        $api->get('/lottery/{id}', 'LotteryController@show');
        $api->get('/lottery/{id}/data', 'LotteryController@datas');
        $api->get('/lottery/{id}/award', 'LotteryController@awards');

        /* 新闻相关接口 */
        $api->get('/news', 'NewsController@index');
        $api->get('/news/latest', 'NewsController@getListLatest');
        $api->get('/news/search', 'NewsController@search');
        $api->get('/news/{id}', 'NewsController@show');
        $api->post('/news/{id}/comment', 'NewsController@postComment');
        $api->get('/channels', 'NewsController@channel');
        $api->get('/channel/{id}/news', 'NewsController@getListByChannel');


        /* 认证授权相关接口 */
        $api->group(['middleware' => ['jwt.auth', 'api.logs']], function ($api) {
            $api->get('/users', 'TestController@index');
            $api->get('/user/{id}', 'TestController@show');

            $api->get('/auth/apps', 'TestController@apps');
            $api->get('/auth/user', 'AuthController@getUser');
            $api->patch('/auth/refresh', 'AuthController@patchRefresh');
            $api->delete('/auth/invalidate', 'AuthController@deleteInvalidate');

            /* 抽奖相关接口 */
            $api->get('/lotterys', 'LotteryController@index');
            $api->get('/lottery/{id}', 'LotteryController@show');
            $api->get('/lottery/{id}/data', 'LotteryController@datas');
            $api->get('/lottery/{id}/award', 'LotteryController@awards');

            /* 新闻相关接口 */
            $api->get('/news', 'NewsController@index');
            $api->get('/news/latest', 'NewsController@getListLatest');
            $api->get('/news/search', 'NewsController@search');
            $api->get('/news/{id}', 'NewsController@show');
            $api->post('/news/{id}/comment', 'NewsController@postComment');
            $api->get('/channels', 'NewsController@channel');
            $api->get('/channel/{id}/news', 'NewsController@getListByChannel');
        });
    });
});

